import axios from "axios";
import { Dialog } from "vant";

const instance = axios.create({  //设置请求前缀
    baseURL:'/api'
})
// 设置响应拦截器
instance.interceptors.response.use((res) =>{
    const {data: _data } = res
    const { data, code ,msg } = _data
    if( code !==0 ){
        Dialog.alert({
            message:msg
        }).then(() =>{
            //关闭弹窗
        })
        return Promise.reject(msg)
    }
    return data
})

export default instance